<%--
  Created by IntelliJ IDEA.
  User: 施明
  Date: 2019/5/21
  Time: 20:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<c:set var="path" value="${pageContext.request.contextPath}"></c:set>
<head>
    <meta charset="utf-8">
    <title>员工列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <link rel="stylesheet" href="${path}/layuiadmin/style/admin.css" media="all">


    <link rel="stylesheet" href="${path}/layuiadmin/layui/css/layui.css" media="all">


</head>

<body>
<div class="layui-form-item">

    <div class="layui-inline">

        <%--<!-- 搜索框 -->
        <div class="demoTable">
            姓名：
            <div class="layui-inline">
                <input class="layui-input" name="empname" id="demoReload"
                       autocomplete="off">
            </div>
            <button class="layui-btn" data-type="reload">搜索</button>
        </div>--%>
    </div>
</div>

<!-- 添加员工信息的表单 -->
<div id="addemployee" style="display: none">
    <!-- 这里给一个弹出表单 -->
    <form class="layui-form" lay-filter="example">
        <div class="layui-form-item">
            <label class="layui-form-label">活动名</label>
            <div class="layui-input-block">
                <input type="text" name="flashsalename" id="flashsalename" lay-verify="title"
                       autocomplete="off" placeholder="请输入活动名"
                       class="layui-input">
            </div>
        </div>


        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">开始时间</label>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="flashsalestartime" placeholder="yyyy-MM-dd HH:mm:ss" name="flashsalestartime">
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">结束时间</label>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="flashsaleendtime" placeholder="yyyy-MM-dd HH:mm:ss" name="flashsaleendtime">
                </div>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn btn-update" type="button" lay-submit=""
                        lay-filter="demo1">保存
                </button>
            </div>
        </div>
    </form>
</div>

<table class="layui-hide" id="test" lay-filter="test"></table>

<script type="text/html" id="toolbarDemo">
   <%-- <div class="layui-btn-container">

        <button class="layui-btn layui-btn-sm" lay-event="addactivity">添加活动</button>
    </div>--%>
</script>

<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs" lay-event="edit" title="查看商品">查看商品</a>
    <a class="layui-btn layui-btn-xs" lay-event="addgoods">添加活动商品</a>
</script>

<script src="${path}/layuiadmin/layui/layui.js"></script>

<script>

    layui.use('table', function () {
        var table = layui.table;
        table.render({
            elem: '#test'
            ,
            url: '/adminflashsale.action/flashsalepage' //数据接口
            ,
            toolbar: '#toolbarDemo',
            title: '秒杀活动信息表',
            cols: [
                [
                    //{type: 'checkbox', fixed: 'left'}，
                     {field: 'flashsaleid', width: 90, title: '活动ID', sort: true}
                    , {field: 'flashsalename', width: 180, title: '活动名'}
                    , {field: 'flashstarttime', width: 180, title: '开始时间'}
                    , {field: 'flashendtime', width: 180, title: '结束时间'}
                    , {fixed: 'right', title: '操作', toolbar: '#barDemo', width: 200}
                ]
            ],
            page: true,
            id: 'testReload'
        });

        //头工具栏事件
        table.on('toolbar(test)', function (obj) {
            var checkStatus = table.checkStatus(obj.config.id);
                        layer.open({
                        type : 2,
                        area : ['500px', '400px'],
                        maxmin : true,
                        content : "${path}/admin.action/addflashgoods?"
                    });
        });
        //监听行工具事件
        table.on('tool(test)', function (obj) {
            var data = obj.data;
            if(obj.event === 'addgoods'){
               // alert(data.flashsaleid);
                layer.open({
                    type : 2,
                    area : ['700px', '450px'],
                    maxmin : true,
                    content : "${path}/admin.action/addflashgoods?orderId="+ data.flashsaleid
                });
            } else if (obj.event === 'edit') {
                    //alert(data.flashsaleid);
                    layer.open({
                        type : 2,
                        area : ['700px', '450px'],
                        maxmin : true,
                        content : "${path}/adminflashgoods.action/admininquireflashgoods?fsid=" + data.flashsaleid
                    });

            }
        });

    });

    layui.use('laydate', function () {
        var laydate = layui.laydate;
        //常规用法
        laydate.render({
            elem: '#flashsaleendtime'
            , type : 'datetime'
        });
        //常规用法
        laydate.render({
            elem: '#flashsalestartime'
            , type : 'datetime'
        });

    });
</script>

</body>

</html>
